package com.weibo.service;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;

import com.weibo.db.DataBaseConnection;
import com.weibo.entity.Separate;

public class SeparateImpl extends  DataBaseConnection{
	/*查询所有*/
	public List<Object> findAll(){
	
		String sql = "select * from separate";
		ResultSet rs=null;
		try {
			rs = super.getResultSet(sql, null);
		} catch (SQLException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		List<Object> list = new LinkedList<Object>();
		try {
			while(rs.next()){
				Separate s = new Separate();
				s.setId(rs.getInt("id"));
				s.setName(rs.getString("name"));
				list.add(s);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}finally{
			super.closeAll();
		}
		return list;
	}
}
